package org.d8_transform_stream;
import java.io.*;
/**
 * 掌握字符输入转换流的使用
 */
public class InputStreamReader {
    public static void main(String[] args) {

        try (
                //得到文件原始的字节流(GBK字节形式)
                InputStream is = new FileInputStream("D:\\idea\\idea code\\java-practice\\practice\\change\\file-oi-app\\src\\d8test.txt");
                //2.把原始的字节输入流按照指定的字符集编码转换成字符输入流
                Reader isr = new java.io.InputStreamReader(is,"UTF-8");  //在这里更改字符编码
                //3.把字符输入流包装成缓冲字符输入流
                BufferedReader br = new BufferedReader(isr);
        )
        {
            String line;
            while ((line = br.readLine()) != null){
                System.out.println(line);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
